{foreach key=subpackage item=files from=$fileleftindex}
    {if $subpackage != ""}<subpackage name="{$subpackage}">{/if}
    {section name=files loop=$files}
        <file{if $files[files].link != ''} path="{$files[files].link}.xml"{/if}>{$files[files].title}</file>
    {/section}
    {if $subpackage != ""}</subpackage>{/if}
{/foreach}
